package com.mercenary.wein.screenControl.ui;

import com.mercenary.wein.screenControl.ui.batch.*;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.ButtonGroup;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JRadioButton;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.JTextArea;
import javax.swing.JTextField;
import javax.swing.ScrollPaneConstants;
import javax.swing.table.DefaultTableCellRenderer;

//J3面板是显示手机屏幕的面板
public class first extends JFrame {

    static JPanel J1 = new JPanel();
    static JPanel J2 = new JPanel();
    static JTextArea area = new JTextArea();
    static JScrollPane J3 = new JScrollPane(area);
    static JPanel J4 = new JPanel();
    static JPanel J5 = new JPanel();
    static JPanel J6 = new JPanel();
    static JPanel J7 = new JPanel();
    static JPanel J8 = new JPanel();
    static JPanel Joperation = new JPanel();//存放列表
    //static JScrollPane Joperation;
    static JPanel Joperation1 = new JPanel();
    static JPanel Joperation2 = new JPanel();
    static JScrollPane Joperation3 = new JScrollPane(area);
    static int v = ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS;
    static int h = ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER;//

    static JScrollPane scroll = new JScrollPane(area);

    static JPanel Joperation4 = new JPanel();
    static JPanel addressbookJ1 = new JPanel();
    static JPanel addressbookJ2 = new JPanel();
    static JPanel addressbookJ3 = new JPanel();
    static JLabel L1 = new JLabel("A");
    static JLabel L2 = new JLabel("B");
    static JLabel L3 = new JLabel("C");
    static JLabel L4 = new JLabel();
    //菜单栏按钮
    static JButton B1 = new JButton("设备");
    static JButton B2 = new JButton("批量");
    static JButton B3 = new JButton("微控");
    static JButton B4 = new JButton("消息");
    //static JButton B5=new JButton("设置");
    //显示设备面板按钮
    static JButton B6 = new JButton("显示");
    static JButton B7 = new JButton("断开");
    static JButton newBUTTON = new JButton("新建分组");
    //单，群控面板按钮
    static JRadioButton JRB1 = new JRadioButton("单控");
    static JRadioButton JRB2 = new JRadioButton("群控");
    //static JTextField T1=new JTextField("全部设备");
    //批量操作的按钮
    static JButton batchB1 = new JButton("打开微信");
    static JButton batchB2 = new JButton("打开qq");
    static JButton batchB3 = new JButton("打开浏览器");
    static JButton batchB4 = new JButton("返回主界面");
    static JButton batchB5 = new JButton("打开手机屏幕");
    static JButton batchB6 = new JButton("关闭手机屏幕");
    static JButton batchB7 = new JButton("打开飞行模式");
    static JButton batchB8 = new JButton("关闭飞行模式");
    static JButton batchB9 = new JButton("打开手机");
    static JButton batchB0 = new JButton("关闭手机");
    //微信操作的按钮
    static JButton wxB1 = new JButton("导入通讯录");
    static JButton wxB2 = new JButton("添加通讯录好友");
    static JButton wxB3 = new JButton("添加群聊好友");
    static JButton wxB4 = new JButton("添加搜索好友");
    static JButton wxB5 = new JButton("发朋友圈");
    static JButton wxB6 = new JButton("群发消息");
    static JButton wxB7 = new JButton("打招呼");
    static JButton wxB8 = new JButton("接受打招呼");
    static JButton wxB9 = new JButton("接受好友请求");
    static JButton wxB0 = new JButton("模拟定位");
    static JButton wxBa = new JButton("接受摇一摇打招呼");
    static JButton wxBb = new JButton("朋友圈点赞");
    static JButton wxBc = new JButton("摇一摇手机");
    //设备信息的按钮
    static JPanel Jtitle = new JPanel();
    static JLabel JLabel1 = new JLabel("在线设备");
    static JTextField num = new JTextField();
    static JLabel JLabel2 = new JLabel("台");

    public first() {
        super("微群控");
        setLayout(new BorderLayout());
        setVisible(true);
        setExtendedState(JFrame.MAXIMIZED_BOTH);
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        add(J1, BorderLayout.WEST);
        add(J2, BorderLayout.CENTER);
        add(J3, BorderLayout.EAST);
    }

    public static void main(String[] arge) {
        final first one = new first();
        J1.setPreferredSize(new Dimension(80, 600));//设置大小
        J1.setBackground(Color.black);
        J3.setPreferredSize(new Dimension(1050, 600));//设置大小
        J3.setBackground(Color.lightGray);
        J4.setPreferredSize(new Dimension(300, 180));
        J2.setPreferredSize(new Dimension(300, 600));
        J4.setBackground(Color.PINK);
        J2.setLayout(new BorderLayout());
        J2.add(Joperation, BorderLayout.NORTH);
        //Joperation.setContentPane(scroll);
        Joperation.setPreferredSize(new Dimension(120, 565));
        Joperation1.setPreferredSize(new Dimension(120, 555));
        Joperation2.setPreferredSize(new Dimension(120, 565));
        Joperation3.setPreferredSize(new Dimension(120, 540));
        J2.add(J4, BorderLayout.SOUTH);
        J4.setLayout(new BorderLayout());
        J4.add(J5, BorderLayout.WEST);
        J5.setBackground(Color.orange);
        J5.setPreferredSize(new Dimension(100, 120));
        J4.add(J6, BorderLayout.EAST);
        J6.setBackground(Color.pink);
        J6.setPreferredSize(new Dimension(100, 120));
        FlowLayout layout = new FlowLayout();
        J1.setLayout(layout);
        layout.setVgap(30);
        J1.add(B1);
        J1.add(B2);
        J1.add(B3);
        J1.add(B4);
        //J1.add(B5);
        B6.setPreferredSize(new Dimension(100, 30));
        B7.setPreferredSize(new Dimension(100, 30));
        newBUTTON.setPreferredSize(new Dimension(100, 30));

        J6.add(B6);
        J6.add(B7);
        J6.add(newBUTTON);
        GroupComboBox comboBox = new GroupComboBox();
        J6.add(comboBox);
        comboBox.setPreferredSize(new Dimension(100, 30));
        J5.add(JRB1);
        J5.add(JRB2);
        ButtonGroup group = new ButtonGroup();// 创建单选按钮组
        group.add(JRB1);// 将radioButton1增加到单选按钮组中
        group.add(JRB2);// 将radioButton2增加到单选按钮组中
        J5.validate();
        J6.validate();
        batchB1.setPreferredSize(new Dimension(100, 30));
        batchB2.setPreferredSize(new Dimension(100, 30));
        batchB3.setPreferredSize(new Dimension(100, 30));
        batchB4.setPreferredSize(new Dimension(100, 30));
        batchB5.setPreferredSize(new Dimension(100, 30));
        batchB6.setPreferredSize(new Dimension(100, 30));
        batchB7.setPreferredSize(new Dimension(100, 30));
        batchB8.setPreferredSize(new Dimension(100, 30));
        batchB9.setPreferredSize(new Dimension(100, 30));
        batchB0.setPreferredSize(new Dimension(100, 30));
        wxB1.setPreferredSize(new Dimension(100, 30));
        wxB2.setPreferredSize(new Dimension(100, 30));
        wxB3.setPreferredSize(new Dimension(100, 30));
        wxB4.setPreferredSize(new Dimension(100, 30));
        wxB5.setPreferredSize(new Dimension(100, 30));
        wxB6.setPreferredSize(new Dimension(100, 30));
        wxB7.setPreferredSize(new Dimension(100, 30));
        wxB8.setPreferredSize(new Dimension(100, 30));
        wxB9.setPreferredSize(new Dimension(100, 30));
        final FlowLayout layout1 = new FlowLayout(1, 120, 20);
        final FlowLayout layout2 = new FlowLayout(1, 120, 20);
        final GridLayout layout3 = new GridLayout(0, 2);//Layout(1,120,20);
        final FlowLayout layout4 = new FlowLayout();
        //显示按钮的点击事件,即手机屏幕投屏???????
        B6.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {

                J3.validate();
                //tabPanel.setVisible(true);
            }
        });
        ////断开按钮的点击事件，即手机屏幕与pc断开??????
        B7.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {

                J3.validate();
                //tabPanel.setVisible(true);
            }
        });
        //新建分组的按钮点击事件????
        newBUTTON.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                //新建分组的弹出框
                //String inputValue = JOptionPane.showInputDialog("请输入分组名称");
                InputDialog inputdialog = new InputDialog(one);
                Joperation.validate();
                //tabPanel.setVisible(true);
            }
        });
        //
        //设备按钮的点击事件，就是要给数值rowData传值??????
        B1.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {

                Joperation.removeAll();

                Joperation.repaint();
                Joperation.setLayout(new BorderLayout());
                Jtitle.setLayout(layout4);
                Jtitle.add(JLabel1);
                Jtitle.add(num);
                Jtitle.add(JLabel2);
                //设置在线手机总数
                num.setText("12");
                Jtitle.setPreferredSize(new Dimension(100, 30));
                Jtitle.setBackground(Color.LIGHT_GRAY);
                Joperation.add(Jtitle, BorderLayout.NORTH);
                Joperation.add(Joperation3, BorderLayout.SOUTH);
                final Object[] columnNames = {"手机", "分组"};
                Object[][] rowData = {{"dfhjd", "默认"}, {"123", "默认"}, {"2345", "默认分组"}};
                JTable mobilelist = new JTable(rowData, columnNames);
                // mobilelist .setPreferredScrollableViewportSize(new Dimension(200, 90));
                DefaultTableCellRenderer table = new DefaultTableCellRenderer();// 设置table内容居中
                Joperation3.setViewportView(mobilelist);
                // table.setHorizontalAlignment(SwingConstants.CENTER);// 这句和上句作用一样
                mobilelist.setDefaultRenderer(Object.class, table);
                mobilelist.setPreferredScrollableViewportSize(new Dimension(100, 20));
                System.out.println(2);
                Joperation.validate();
            }
        });
        //批量按钮的点击事件
        B2.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                Joperation.removeAll();
                Joperation.repaint();
                Joperation1.setLayout(layout1);
                Joperation1.add(batchB1);
                Joperation1.add(batchB2);
                Joperation1.add(batchB3);
                Joperation1.add(batchB4);
                Joperation1.add(batchB5);
                Joperation1.add(batchB6);
                Joperation1.add(batchB7);
                Joperation1.add(batchB8);
                Joperation1.add(batchB9);
                Joperation1.add(batchB0);
                Joperation.add(Joperation1);
                Joperation.validate();
            }
        });

        //微控按钮的点击事件
        B3.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                Joperation.removeAll();
                Joperation.repaint();

                //Joperation = new JScrollPane(Joperation2,v,h);
                Joperation2.setLayout(layout2);
                Joperation2.add(wxB1);
                Joperation2.add(wxB2);
                Joperation2.add(wxB3);
                Joperation2.add(wxB4);
                Joperation2.add(wxB5);
                Joperation2.add(wxB6);
                Joperation2.add(wxB7);
                Joperation2.add(wxB8);
                Joperation2.add(wxB9);
                Joperation2.add(wxB0);
                Joperation2.add(wxBa);
                Joperation2.add(wxBb);
                Joperation2.add(wxBc);
                Joperation.add(Joperation2);
                //scroll.add(Joperation2);
                Joperation.validate();
            }

        });

        //打开微信按钮点击事件，点击该按钮后，群控模式下在线手机打开微信主界面?????
        batchB1.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {


            }
        });
        //打开qq按钮点击事件，点击该按钮后，群控模式下在线手机打开qq界面?????
        batchB2.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {


            }
        });
        //打开浏览器按钮点击事件，点击该按钮后，群控模式下在线手机打开浏览器界面?????
        batchB3.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {


            }
        });
        //返回主界面按钮点击事件，点击该按钮后，群控模式下在线手机回到主界面?????
        batchB4.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {


            }
        });
        //打开手机屏幕按钮点击事件，点击该按钮后，群控模式下在线手机打手机屏幕（解锁）?????
        batchB5.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {


            }
        });
        //关闭手机屏幕按钮点击事件，点击该按钮后，群控模式下在线手机关闭手机屏幕?????
        batchB6.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {


            }
        });
        //打开飞行模式点击事件，点击该按钮后，群控模式下在线手机将打开飞行模式?????
        batchB7.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {


            }
        });
        //关闭飞行模式点击事件，点击该按钮后，群控模式下在线手机将关闭飞行模式?????
        batchB8.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {


            }
        });
        //打开手机按钮点击事件，点击该按钮后，群控模式下在线手机开机?????
        batchB9.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {


            }
        });
        //关闭手机按钮点击事件，点击该按钮后，群控模式下在线手机关机?????
        batchB0.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {


            }
        });
        //导入通讯录按钮的处理事件
        wxB1.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                ImportAddressBook A = new ImportAddressBook();


            }
        });
        //模拟定位按钮的处理事件
        wxB0.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                LocationOperation B = new LocationOperation();


            }
        });

        //模拟定位按钮的处理事件?????
        wxB5.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                SendStateInFriendCircle C = new SendStateInFriendCircle();


            }
        });
        //一键接受好友请求按钮的处理事件？？？
        wxB9.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                AcceptFriendRequest D = new AcceptFriendRequest();


            }
        });
        wxBa.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                AcceptShakeGreet E = new AcceptShakeGreet();


            }
        });
    }


    public static void constructBatch() {
        JButton batchB1 = new JButton("打开微信");
        JButton batchB2 = new JButton("打开qq");
        JButton batchB3 = new JButton("打开浏览器");
        JButton batchB4 = new JButton("返回主界面");
        JButton batchB5 = new JButton("打开手机屏幕");
        JButton batchB6 = new JButton("关闭手机屏幕");
        JButton batchB7 = new JButton("打开飞行模式");
        JButton batchB8 = new JButton("关闭飞行模式");
        JButton batchB9 = new JButton("打开手机");
        JButton batchB0 = new JButton("关闭手机");
        JButton bmm = new JButton();
        batchB1.setPreferredSize(new Dimension(100, 30));
        batchB2.setPreferredSize(new Dimension(100, 30));
        batchB3.setPreferredSize(new Dimension(100, 30));
        batchB4.setPreferredSize(new Dimension(100, 30));
        batchB5.setPreferredSize(new Dimension(100, 30));
        batchB6.setPreferredSize(new Dimension(100, 30));
        batchB7.setPreferredSize(new Dimension(100, 30));
        batchB8.setPreferredSize(new Dimension(100, 30));
        batchB9.setPreferredSize(new Dimension(100, 30));
        batchB0.setPreferredSize(new Dimension(100, 30));
        FlowLayout layout = new FlowLayout(1, 120, 20);// layout=new BoxLayout(Joperation, BoxLayout.PAGE_AXIS);
        Joperation.setLayout(layout);

        Joperation.add(batchB1);
        Joperation.add(batchB2);
        Joperation.add(batchB3);
        Joperation.add(batchB4);
        Joperation.add(batchB5);
        Joperation.add(batchB6);
        Joperation.add(batchB7);
        Joperation.add(batchB8);
        Joperation.add(batchB9);
        Joperation.add(batchB0);
    }

    public static void constructWX() {
        JButton wxB1 = new JButton("导入通讯录");
        JButton wxB2 = new JButton("添加通讯录好友");
        JButton wxB3 = new JButton("添加群聊好友");
        JButton wxB4 = new JButton("添加搜索好友");
        JButton wxB5 = new JButton("发朋友圈");
        JButton wxB6 = new JButton("群发消息");
        JButton wxB7 = new JButton("打招呼");
        JButton wxB8 = new JButton("接受打招呼");
        JButton wxB9 = new JButton("接受好友请求");
        JButton wxB0 = new JButton("接受附近人打招呼");
        JButton wxBa = new JButton("接受摇一摇打招呼");
        JButton wxBb = new JButton("朋友圈点赞");
        JButton wxBc = new JButton("摇一摇手机");
        FlowLayout layout = new FlowLayout(1, 120, 20);// layout=new BoxLayout(Joperation, BoxLayout.PAGE_AXIS);
        Joperation.setLayout(layout);
        wxB1.setPreferredSize(new Dimension(100, 30));
        wxB2.setPreferredSize(new Dimension(100, 30));
        wxB3.setPreferredSize(new Dimension(100, 30));
        wxB4.setPreferredSize(new Dimension(100, 30));
        wxB5.setPreferredSize(new Dimension(100, 30));
        wxB6.setPreferredSize(new Dimension(100, 30));
        wxB7.setPreferredSize(new Dimension(100, 30));
        wxB8.setPreferredSize(new Dimension(100, 30));
        wxB9.setPreferredSize(new Dimension(100, 30));
        Joperation.add(wxB1);
        Joperation.add(wxB2);
        Joperation.add(wxB3);
        Joperation.add(wxB4);
        Joperation.add(wxB5);
        Joperation.add(wxB6);
        Joperation.add(wxB7);
        Joperation.add(wxB8);
        Joperation.add(wxB9);
        Joperation.add(wxB0);
        Joperation.add(wxBa);
        Joperation.add(wxBb);
        Joperation.add(wxBc);
    }
}